﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package com.facebook.delegates {
    import flash.display.*;
    import flash.utils.*;
    import com.facebook.net.*;
    import flash.net.*;
    import com.facebook.session.*;
    import com.adobe.crypto.*;

    public class RequestHelper {

        protected static var callID:int = 0;

        public static function formatRequest(_arg1:FacebookCall):void{
            var _local2:IFacebookSession = _arg1.session;
            _arg1.setRequestArgument("v", _local2.api_version);
            if (_local2.api_key != null){
                _arg1.setRequestArgument("api_key", _local2.api_key);
            };
            if (((!((_local2.session_key == null))) && (_arg1.useSession))){
                _arg1.setRequestArgument("session_key", _local2.session_key);
            };
            var _local3:String = (new Date().time.toString() + callID++.toString());
            _arg1.setRequestArgument("call_id", _local3);
            _arg1.setRequestArgument("method", _arg1.method);
            _arg1.setRequestArgument("sig", formatSig(_arg1));
        }
        public static function formatSig(_arg1:FacebookCall):String{
            var _local4:String;
            var _local5:String;
            var _local6:*;
            var _local2:IFacebookSession = _arg1.session;
            var _local3:Array = [];
            for (_local4 in _arg1.args) {
                _local6 = _arg1.args[_local4];
                if (((((((((!((_local4 === "sig"))) && (!((_local6 is ByteArray))))) && (!((_local6 is FileReference))))) && (!((_local6 is BitmapData))))) && (!((_local6 is Bitmap))))){
                    _local3.push(((_local4 + "=") + _local6.toString()));
                };
            };
            _local3.sort();
            _local5 = _local3.join("");
            if (_local2.secret != null){
                _local5 = (_local5 + _local2.secret);
            };
            return (MD5.hash(_local5));
        }

    }
}//package com.facebook.delegates 
